package com.example.first;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import javax.security.auth.login.LoginException;

public class ConfigActivity2 extends AppCompatActivity {
    TextView name;
    EditText RMB;
    TextView result;
    float result1;
    float rate;
    float rmb;
    public static final String TAG="caculate";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_config2);
        Intent intent=getIntent();
        name=(TextView)findViewById(R.id.name);
        String name2=intent.getStringExtra("name1");
        name.setText(name2);
        rate=intent.getFloatExtra("rate1",0.0F);
        Log.i(TAG,"获取汇率"+rate);
        Log.i(TAG,"获取币种"+name2);
    }
    public void c(View btn) {
        if(btn.getId()==R.id.title) {
            RMB=findViewById(R.id.input);
            rmb = Float.valueOf(String.valueOf(RMB.getText()));
            result1 = (100*rmb)/rate;
            Log.i(TAG, "计算结果" + result1);
            result= findViewById(R.id.r);
            result.setText(String.valueOf(result1));
        }
    }
}